Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
super-media-element
Advanced tools
A custom element that helps save alienated player API's to bring back their true inner HTMLMediaElement API, or to extend a native media element like <audio>
or <video>
.
import { SuperVideoElement } from 'super-media-element';
class MyVideoElement extends SuperVideoElement {
constructor() {
super();
this.loadComplete = new Promise((resolve) => {
this.loadResolve = resolve;
});
}
async attributeChangedCallback(attrName, oldValue, newValue) {
// This is required to come before the await for resolving loadComplete.
if (attrName === 'src' && newValue) {
this.load();
return;
}
super.attributeChangedCallback(attrName, oldValue, newValue);
}
async load() {
if (this.hasLoaded) {
this.loadComplete = new Promise((resolve) => {
this.loadResolve = resolve;
});
}
this.hasLoaded = true;
// Wait 1 tick to allow other attributes to be set.
await Promise.resolve();
// code to load a video element from a script
// example: https://github.com/luwes/jwplayer-video-element/blob/main/src/jwplayer-video-element.js#L49-L69
this.loadResolve();
}
get nativeEl() {
return this.querySelector('.loaded-video-element');
}
get src() {
return this.getAttribute('src');
}
set src(val) {
if (this.src == val) return;
this.setAttribute('src', val);
}
}
if (!globalThis.customElements.get('my-video')) {
globalThis.customElements.define('my-video', MyVideoElement);
globalThis.MyVideoElement = MyVideoElement;
}
export { MyVideoElement };
<mux-video>
A Mux-flavored HTML5 video element w/ hls.js and Mux data builtin.<youtube-video>
A web component for the YouTube player.<wistia-video>
A web component for the Wistia player.<jwplayer-video>
A web component for the JW player.<hls-video>
A web component for playing HTTP Live Streaming (HLS) videos.<videojs-video>
A web component for Video.js.castable-video
Cast your video element to the big screen with ease!<mux-player>
The official Mux-flavored video player web component.FAQs
Helps you create a custom element w/ a HTMLMediaElement API.
The npm package super-media-element receives a total of 858 weekly downloads. As such, super-media-element popularity was classified as not popular.
We found that super-media-element demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.